#include "vsf.h"

void vsfstream_adapter_onin(void *param)
{
	struct vsf_stream_adapter_t *adapter = (struct vsf_stream_adapter_t *)param;
	if (adapter->on_inout != NULL) adapter->on_inout(adapter, true);
}

void vsfstream_adapter_onout(void *param)
{
	struct vsf_stream_adapter_t *adapter = (struct vsf_stream_adapter_t *)param;
	if (adapter->on_inout != NULL) adapter->on_inout(adapter, false);
}

vsf_err_t vsfstream_adapter_init(struct vsf_stream_adapter_t *adapter)
{
	adapter->in->callback_rx.param = adapter;
	adapter->in->callback_rx.on_inout = vsfstream_adapter_onin;
	vsfstream_connect_rx(adapter->in);
	adapter->out->callback_tx.param = adapter;
	adapter->out->callback_tx.on_inout = vsfstream_adapter_onout;
	vsfstream_connect_tx(adapter->out);
	return VSFERR_NONE;
}
